<template>
  <div>
    <div v-title>测试</div>
    <!-- <div class="logo">
      <misi></misi>
    </div> -->

    <!-- <sticky> -->
    <!-- <x-header :left-options="{showBack: false,preventGoBack:true}" style="background-color: #4ab7f7;">{{business.name}}在线点餐</x-header> -->

    <!-- <x-header :left-options="{showBack: false,preventGoBack:true}"> -->

    <!-- <div class="overwrite-title-demo">
        <button-tab v-model="selecttab">
          <button-tab-item @on-item-click="itemClick">点餐</button-tab-item>
          <button-tab-item @on-item-click="itemClick">服务</button-tab-item>
          <button-tab-item @on-item-click="itemClick">抢赏金</button-tab-item>
          <button-tab-item @on-item-click="itemClick">我的</button-tab-item> 
        </button-tab>
      </div> -->
    <!-- <tab bar-active-color="#ffa500" active-color="#ffa500">
        <tab-item selected @on-item-click="itemClick">点餐列表</tab-item>
        <tab-item @on-item-click="itemClick">呼叫服务</tab-item>
      </tab> -->

    <!-- </x-header> -->

    <keep-alive>
      <router-view @viewIn="selectItem" class="view" v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>

    <router-view @viewIn="selectItem" class="view" v-if="!$route.meta.keepAlive"></router-view>

    <tabbar v-model="selecttab" style="position: fixed;background-color:#fff;color: #000; ">
      <tabbar-item :link="{path:'/Seller/'+this.$store.getters.getSellerId+'/'+this.$store.getters.getFxrId,replace:true}">
        <i slot="icon" class="iconfont icon-home"></i>
        <span slot="label">首页</span>
      </tabbar-item>
      <tabbar-item v-if="showCplist" :link="{path:'/CpList',replace:true}" style="color: #000;">
        <i slot="icon" class="iconfont icon-leicanyinzhusux"></i>
        <span slot="label">点餐</span>
      </tabbar-item>
      <tabbar-item :link="{path:'/Wifi',replace:true}" style="color: #000;">
        <i slot="icon" class="iconfont icon-wifi"></i>
        <span slot="label">wifi</span>
      </tabbar-item>
      <tabbar-item :link="{path:'/Member/'+this.$store.getters.getMemberPtOpenId,replace:true}" style="color:#000">
        <i slot="icon" class="iconfont icon-wo"></i>
        <span slot="label">我的</span>
      </tabbar-item>
    </tabbar>
  </div>
</template>
<script>
import { XHeader, ButtonTab, ButtonTabItem, Tabbar, TabbarItem } from "vux";

export default {
  components: {
    XHeader,
    ButtonTab,
    ButtonTabItem,
    Tabbar,
    TabbarItem
  },
  data() {
    return {
      // note: changing this line won't causes changes
      // with hot-reload because the reloaded component
      // preserves its current state and we are modifying
      // its initial state.
      msg: "Hello World!",
      business: null,
      openid: null,
      selecttab: 0,
      showCplist:false,
    };
  },
  methods: {
    selectItem(name) {
      this.$nextTick(() => {
        if(this.$store.state.sellerInfo!=null && this.$store.state.sellerInfo.isDianc == 1)
        {
          this.showCplist = true;
        }
        // console.log(this.$store.state.sellerInfo)

        if (name == "seller") {
          this.selecttab = 0;
        } else if (name == "cplist") {
          this.selecttab = 1;
        } else if (name == "wifi") {
          if (showCplist) {
            this.selecttab = 2;
          } else {
            this.selecttab = 1;
          }
        
        } else if (name == "member") {
         if (showCplist) {
            this.selecttab = 3;
          } else {
            this.selecttab = 2;
          }
        }
      });
    }
  },
  created() {
    // var binfo = localStorage.getItem("bInfo");
    // this.business =this.$store.state.sellerInfo
 
  }
};
</script>
<style scoped>
.overwrite-title-demo {
  margin-top: 5px;
}
.logo {
  position: absolute;
  z-index: 10;
  width: 46px;
  height: 46px;
}
.view {
  margin-bottom: 50px;
}
</style>
